/*
 * Copyright (c) 2023 HiSilicon (Shanghai) Technologies CO., LIMITED.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Description: platform sha256sum calculate header file
 * Create: 2023-01-13
 */

#ifndef __PLAT_SHA256_CALC_H__
#define __PLAT_SHA256_CALC_H__


#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif

#if defined(_PRE_PLAT_SHA256SUM_CHECK) && (_PRE_PLAT_SHA256SUM_CHECK == 1)

#define SHA256_HEADER_ARR_LEN   32  // 32 Bytes (256 bits).
#define SHA256_HEADER_BYTES_LEN 2   // Each byte is displayed as two characters.
#define SHA256_HEADER_LENGTH    64  // 32 Bytes (256 bits). Each byte is displayed as two characters.

#define FILE_READ_SIZE          (32 * 1024)

osal_s32 do_sha256(const osal_char *data, osal_u32 datalen, osal_char *out_digest);
osal_s32 firmware_sha256_checksum(const osal_char *path);

#endif // defined(_PRE_PLAT_SHA256SUM_CHECK) && (_PRE_PLAT_SHA256SUM_CHECK == 1)

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

#endif
